package cc.javaee.bbs.dao.activity;

import cc.javaee.bbs.dao.BaseDao;
import cc.javaee.bbs.model.activity.KbrActivityPrize;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public class ActivityPrizeDao extends BaseDao {
	String ns="kbr_activity_prize.";
	
	public List<KbrActivityPrize> find(KbrActivityPrize KbrActivityPrize) {
		List<KbrActivityPrize> list=this.getSqlSession().selectList(ns+"find", KbrActivityPrize);
		if(list!=null&&list.size()>0){
			for (KbrActivityPrize act : list) {
			}
		}
		return list;
	}

	public void insert(KbrActivityPrize KbrActivityPrize) {
		this.getSqlSession().insert(ns+"insert", KbrActivityPrize);
	}

	public void delete(Integer id) {
		this.getSqlSession().delete(ns+"delete", id);
	}
	
	public void deleteByActId(Integer actId) {
		this.getSqlSession().delete(ns+"deleteByActId", actId);
	}

	public void update(KbrActivityPrize KbrActivityPrize) {
		this.getSqlSession().update(ns+"update", KbrActivityPrize);
	}
	public void updatejifen(Integer userid) {
		this.getSqlSession().update(ns+"updatejifen", userid);
	}
	public Map<String, Object> userjifengroup(KbrActivityPrize user) {
		return this.getSqlSession().selectOne(ns+"getjifengroup", user);
	}
	public Map<String, Object> findziliao(KbrActivityPrize user) {
		return this.getSqlSession().selectOne(ns+"findziliao", user);
	}

	// 更新使用次数
	public void updateUseCount(KbrActivityPrize user) {
		this.getSqlSession().update(ns+"updateUseCount", user.getId());
	}

}